package com.chiry.thread.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.util.concurrent.TimeUnit;

@Service
@Slf4j
public class ThreadService {
    @Async("asyncServiceExecutor")
    public void send(String phone, int code) {
        //发短信
        try {
            TimeUnit.SECONDS.sleep(5);  //模拟发送短信
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        log.info(Thread.currentThread().getName());
        System.out.println("发送短信成功：code ="+code);

    }
}
